/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.openbrew.openbrewrf;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author dchapman
 */
@Entity
@Table(name = "SaltNotes")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "SaltNotes.findAll", query = "SELECT s FROM SaltNotes s"),
    @NamedQuery(name = "SaltNotes.findBySaltNoteID", query = "SELECT s FROM SaltNotes s WHERE s.saltNoteID = :saltNoteID"),
    @NamedQuery(name = "SaltNotes.findBySaltGrams", query = "SELECT s FROM SaltNotes s WHERE s.saltGrams = :saltGrams"),
    @NamedQuery(name = "SaltNotes.findBySaltNotes", query = "SELECT s FROM SaltNotes s WHERE s.saltNotes = :saltNotes")})
public class SaltNotes implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "saltNoteID")
    private Integer saltNoteID;
    @Basic(optional = false)
    @NotNull
    @Column(name = "saltGrams")
    private float saltGrams;
    @Basic(optional = false)
    @NotNull
    @Size(min = 0, max = 250)
    @Column(name = "saltNotes")
    private String saltNotes;
    @JoinColumn(name = "saltID", referencedColumnName = "saltID", nullable=true)
    @ManyToOne(optional = true)
    private WaterSalts waterSaltID;

    public SaltNotes() {
    }

    public SaltNotes(Integer saltNoteID) {
        this.saltNoteID = saltNoteID;
    }

    public SaltNotes(Integer saltNoteID, float saltGrams, String saltNotes) {
        this.saltNoteID = saltNoteID;
        this.saltGrams = saltGrams;
        this.saltNotes = saltNotes;
    }

    public Integer getSaltNoteID() {
        return saltNoteID;
    }

    public void setSaltNoteID(Integer saltNoteID) {
        this.saltNoteID = saltNoteID;
    }

    public float getSaltGrams() {
        return saltGrams;
    }

    public void setSaltGrams(float saltGrams) {
        this.saltGrams = saltGrams;
    }

    public String getSaltNotes() {
        return saltNotes;
    }

    public void setSaltNotes(String saltNotes) {
        this.saltNotes = saltNotes;
    }

    public WaterSalts getWaterSaltID() {
        return waterSaltID;
    }

    public void setWaterSaltID(WaterSalts waterSaltID) {
        this.waterSaltID = waterSaltID;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (saltNoteID != null ? saltNoteID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof SaltNotes)) {
            return false;
        }
        SaltNotes other = (SaltNotes) object;
        if ((this.saltNoteID == null && other.saltNoteID != null) || (this.saltNoteID != null && !this.saltNoteID.equals(other.saltNoteID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.openbrew.openbrewrf.SaltNotes[ saltNoteID=" + saltNoteID + " ]";
    }
    
}
